<?php

error_reporting(E_ALL);

/**
 * reloj-checador - class.controller.php
 *
 * $Id$
 *
 * This file is part of reloj-checador.
 *
 * Automatically generated on 22.08.2013, 19:51:48 with ArgoUML PHP module
 * (last revised $Date: 2010-01-12 20:14:42 +0100 (Tue, 12 Jan 2010) $)
 *
 * @author firstname and lastname of author, <author@example.org>
 */

if (0 > version_compare(PHP_VERSION, '5')) {
	die('This file was generated for PHP 5');
}

/* user defined includes */
// section -64--88-0-101-81690f7:140a816daa7:-8000:0000000000000967-includes begin
// section -64--88-0-101-81690f7:140a816daa7:-8000:0000000000000967-includes end

/* user defined constants */
// section -64--88-0-101-81690f7:140a816daa7:-8000:0000000000000967-constants begin
// section -64--88-0-101-81690f7:140a816daa7:-8000:0000000000000967-constants end

/**
 * Short description of class controller
 *
 * @access public
 * @author firstname and lastname of author, <author@example.org>
 */

require_once 'views/view-inicio.php';

include_once 'class/class.modelo.php';

class controller
{
	// --- ASSOCIATIONS ---


	// --- ATTRIBUTES ---

	// --- OPERATIONS ---

	/**
	 * Short description of method controller
	 *
	 * @access public
	 * @author firstname and lastname of author, <author@example.org>
	 * @return mixed
	 */
	
	
	public function controller()
	{
		// section -64--88-0-101-81690f7:140a816daa7:-8000:000000000000096A begin
		$modelo = new modelo();
		
		if (@$_REQUEST['entrar'] == '1' && isset($_REQUEST['user'])){
			//echo 'hola';
			$modelo->user_name = $_REQUEST['user'];
			$modelo->entrar_login();
		}
		else if (@$_REQUEST['action'] == 'borrar_usuario'){
			$modelo->id = $_REQUEST['id'];
			$modelo->borrar_usuario();
		}
		else if (@$_REQUEST['action'] == 'borrar_personal'){
			$modelo->id = $_REQUEST['id'];
			$modelo->borrar_personal();
		}
		else if (@$_REQUEST['action'] == 'ver_usuarios'){
			$modelo->ver_usuarios();
		}
		else if (@$_REQUEST['action'] == 'add_usuario'){
			$modelo->view_add_usuario();
		}
		else if (@$_REQUEST['action'] == 'add_personal'){
			$modelo->view_add_personal();
		}
		else if (@$_REQUEST['action'] == 'add_new_personal'){
			if ($_POST['tid'] == ''){
				$modelo->add_new_personal();
			}
			else{
				$modelo->update_personal();
			}
		}
		
		else if (@$_REQUEST['action'] == 'add_new_usuario'){
			if ($_POST['tid'] == ''){
				$modelo->add_new_usuario();
			}
			else{
				$modelo->update_usuario();
			}
		}
		
		else if (@$_REQUEST['action'] == 'ver_personal'){
			$modelo->ver_personal();
		}
		else if (@$_REQUEST['action'] == 'entrar'){
			$modelo->entrar();
		}
		else if (@$_REQUEST['action'] == 'close'){
			$modelo->close_session();
		}
		else if (@$_REQUEST['action'] == 'no_user'){
			$modelo->no_user();
		}
		else if(@$_REQUEST['action'] == 'inicio' || @$_REQUEST['action'] == '' ){
			$modelo->inicio();
			$modelo->text = $_REQUEST['text'];
		}
		else if(@$_REQUEST['action'] == 'login' && isset($_POST['tuser']) && isset($_POST['tpass']) ){
			$modelo->user_name = $_REQUEST['tuser'];
			$modelo->user_pass = $_REQUEST['tpass'];
			$modelo->login();
		}
		else if (@$_REQUEST['action'] == 'entry'){
			
		}
		
		// section -64--88-0-101-81690f7:140a816daa7:-8000:000000000000096A end
	}

} /* end of class controller */

?>